//
//  MyCollectionViewCell.m
//  Travel assistant
//
//  Created by 王京 on 16/3/8.
//  Copyright © 2016年 旅游助手. All rights reserved.
//

#import "MyCollectionViewCell.h"

@implementation MyCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        [self cell];
    }
    return self;
}

- (void)cell{
    
    self.imageV = [[UIImageView alloc]init];
    
    self.imageV.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height);
    
    [self.contentView addSubview:self.imageV];
    
    self.imageV.backgroundColor = [UIColor redColor];
    
    self.btn = [UIButton buttonWithType:(UIButtonTypeSystem)];
    
    self.btn.frame = CGRectMake(self.imageV.frame.size.width*0.35, self.imageV.frame.size.height*0.35, 40, 40);
    
    [self.imageV addSubview:self.btn];
    
    self.btn.backgroundColor = [UIColor greenColor];
    
    
    self.label = [[UILabel alloc]init];
    
    self.label.frame = CGRectMake(CGRectGetMinX(self.btn.frame)-10, CGRectGetMaxY(self.btn.frame), self.imageV.frame.size.width, 40);
    
    self.label.text = @"新建账单";
    
    [self.imageV addSubview:self.label];
    
    
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    self.imageV.frame = CGRectMake(20, 10, self.contentView.frame.size.width, self.contentView.frame.size.height);
    
    self.btn.frame = CGRectMake(self.imageV.frame.size.width*0.35, self.imageV.frame.size.height*0.2, 40, 40);
    
    self.label.frame = CGRectMake(CGRectGetMinX(self.btn.frame)-10, CGRectGetMaxY(self.btn.frame), self.imageV.frame.size.width, 40);
    
}


@end
